package com.ganee.agora.adapter

import android.view.View
import android.widget.ImageView
import android.widget.TextView

import androidx.core.content.ContextCompat

import com.chad.library.adapter.base.BaseSectionQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ganee.agora.R
import com.ganee.agora.model.FilterItemEntity
import com.ganee.agora.model.MySection

class SectionFilterAdapter(layoutResId: Int, sectionHeadResId: Int, data: List<MySection>) : BaseSectionQuickAdapter<MySection, BaseViewHolder>(layoutResId, sectionHeadResId, data) {

    override fun convertHead(helper: BaseViewHolder, item: MySection) {
        helper.setText(R.id.text_adapter_title_name, item.header)
    }

    override fun convert(helper: BaseViewHolder, item: MySection) {
        val itemEntity = item.t  as FilterItemEntity
        helper.setText(R.id.tv_content, itemEntity.title)
        if (itemEntity.check) {
            (helper.getView<View>(R.id.tv_content) as TextView).setTextColor(ContextCompat.getColor(mContext, R.color.color_login_yellow))
        } else {
            (helper.getView<View>(R.id.tv_content) as TextView).setTextColor(ContextCompat.getColor(mContext, R.color.color_little_title))
        }

    }
}
